<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>react-demo-10</title>
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC&display=swap"
      rel="stylesheet"
    />
  </head>
  <style lang="scss">
    * {
      font-family: 'Noto Sans SC', sans-serif;
    }

    .title {
      display: inline-flex;
      border: 1px solid blue;
      border-radius: 3px;
    }
  </style>
  <body>
    <!-- 准备容器 -->
    <div id="main"></div>

    <!-- 引入react核心库 -->
    <script
      type="text/javascript"
      src="https://cdn.bootcdn.net/ajax/libs/react/17.0.2/umd/react.development.js"
    ></script>
    <!-- 引入react-dom，用于操作dom -->
    <script
      type="text/javascript"
      src="https://cdn.bootcdn.net/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"
    ></script>
    <!-- 引入babel，用于编译jsx -->
    <script src="https://cdn.bootcdn.net/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>

    <!-- 此处一定要写babel，用于提示babel对该内容进行编译 -->
    <script type="text/babel">
      // 1. 创建组件
      class Person extends React.Component {
        render() {
          // 利用ES6解构对象语法
          const { name, gender, age } = this.props;
          return (
            <ul>
              <li>姓名：{name}</li>
              <li>性别：{gender}</li>
              <li>年龄：{age}</li>
            </ul>
          );
        }
      }

      ReactDOM.render(
        <Person name="Xmo" gender="Male" age="22" />,
        document.getElementById('main')
      );
    </script>
  </body>
</html>
